// 频道推荐数据
export default {
	namespaced : true,
	state : {
		channel: {
			id: 100,
			name: '热门频道',
			channel_count: 100
		},
		total: 100,// 当前频道数据总量
		findList: [],// 左边发现频道列表
		channelVideo: [],// 所有频道视频数据
		channelList: [],// 一百条频道分类数据
		channelSearchNull: [],// 搜索不到数据
		searchWord: '',// 搜索词，改变时发送请求
		loading: false,// 改变频道的状态
	},
	mutations:{
		// 左侧频道列表
		getFindList(state, payload){
			state.findList = payload.categories && payload.categories.filter((item) => item.name != '热门');
		},
		// 热门频道100条分类
		getChannelList(state, payload){
			state.channelList = payload.channels;
		},
		// 改变频道
		setChannel(state, payload){
			state.loading = true;
			state.channel = payload;
		},
		
		
		// 根据id或搜索词获取数据,以及条数
		getChannelVideo(state, payload){
			state.channelVideo = payload.archive_channels || [];
			state.total = payload.total;
			state.loading = false;
		},
		// 加载更多数据
		getMore(state, payload){
			state.channelVideo = state.channelVideo.concat(payload.archive_channels);
		},
		
		
		// 保存搜索词
		setSearchWord(state, payload){
			state.searchWord = payload;
		}
	}
}